#!/usr/bin/env python
# coding=utf-8
"""
十进制浮点数字符串 转换为 IEEE754 标准的十六进制字符串
"""

def main():
    dec = input("Enter the decimal number: ")
    res = ""
    sign = "1" if "-" in dec else "0"
    integer = dec.split(".")[0]
    fraction = dec.split(".")[1]

    int_bi, fraction_bi = int2binary(integer), fraction2binary(fraction)
    res += sign
    res += bin(len(int_bi)-1 + 127)[2:]
    res += (int_bi[1:] + fraction_bi).ljust(23, "0")
    print(hex(int(res, 2)))
    

def int2binary(num):
    binary = []
    num = int(num)
    while num != 0:
        binary.append(str(num % 2))
        num //= 2
    binary = binary[::-1]
    return "".join(binary)


def fraction2binary(fraction):
    binary = []
    f = float("0." + fraction)
    while f != 0:
        binary.append(str(int(f * 2 // 1)))
        f = f * 2 % 1
    return "".join(binary)


if __name__ == '__main__':
    main()
